package demo4;

public class Computer {
    public void openComputer() {
        System.out.println("打开电脑");
    }

    public void closeComputer() {
        System.out.println("关闭电脑");
    }

    public void usdDevice(IUSB iusb) {
        iusb.openDevice();
        if(iusb instanceof Mouse) {
            Mouse mouse = (Mouse) iusb;
            mouse.clickLeft();
            mouse.clickRight();
        }else if(iusb instanceof KeyBoard){
            KeyBoard keyBoard = (KeyBoard) iusb;
            keyBoard.put();
        }else {
            return;
        }
        iusb.closeDevice();
    }
}
